package hongcaosp.app.android.modle.impl;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;

import hongcaosp.app.android.BuildConfig;
import hongcaosp.app.android.modle.BaseResponse;
import hongcaosp.app.android.modle.DataCallBack;
import hongcaosp.app.android.modle.bean.UserInfoWrap;
import hongcaosp.app.android.modle.mi.PasswordModle;

public class PasswordModleImpl implements PasswordModle {
    @Override
    public void sendCode(String mobile,int type, DataCallBack dataCallBack) {
        HttpParams params = new HttpParams();
        params.put("mobile", mobile);
        params.put("type", type);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/sendCode").params(params).execute(dataCallBack);
    }

    @Override
    public void updatePassword(String mobile, String verificationCode, String password, DataCallBack<UserInfoWrap> dataCallBack) {
        HttpParams params = new HttpParams();
        params.put("mobile", mobile);
        params.put("verificationCode", verificationCode);
        params.put("password", password);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/updatePassword").params(params).execute(dataCallBack);
    }

    @Override
    public void bindingMobile(String token, int type, String mobile, String verificationCode, DataCallBack<BaseResponse> dataCallBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("type", type);
        params.put("mobile", mobile);
        params.put("verificationCode", verificationCode);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/user/bindingMobile").params(params).execute(dataCallBack);
    }

    @Override
    public void updatePassWordOld(String token, String password, DataCallBack<BaseResponse> callBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("password", password);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/user/updatePassWordOld").params(params).execute(callBack);
    }

    @Override
    public void updatePassWordNew(String token, String password, String passwordTwo, DataCallBack<BaseResponse> callBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("password", password);
        params.put("passwordTwo", passwordTwo);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/user/updatePassWordNew").params(params).execute(callBack);
    }

    @Override
    public void updatePassWordVerif(String token, String verificationCode, DataCallBack<BaseResponse> callBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("verificationCode", verificationCode);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/user/updatePassWordVerif").params(params).execute(callBack);
    }
}
